/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.osiris.persistence;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author amartinez
 */
@Entity
@Table(name = "Tiporequisito")
@NamedQueries({@NamedQuery(name = "Tiporequisito.findAll", query = "SELECT t FROM Tiporequisito t"), @NamedQuery(name = "Tiporequisito.findByIdTipoRequisito", query = "SELECT t FROM Tiporequisito t WHERE t.idTipoRequisito = :idTipoRequisito"), @NamedQuery(name = "Tiporequisito.findByValor", query = "SELECT t FROM Tiporequisito t WHERE t.valor = :valor"), @NamedQuery(name = "Tiporequisito.findByDescripcion", query = "SELECT t FROM Tiporequisito t WHERE t.descripcion = :descripcion")})
public class Tiporequisito implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idTipoRequisito")
    private Long idTipoRequisito;
    @Column(name = "Valor")
    private String valor;
    @Column(name = "Descripcion")
    private String descripcion;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idTipoRequisito", fetch = FetchType.LAZY)
    private List<Requisito> requisitoList;

    public Tiporequisito() {
    }

    public Tiporequisito(Long idTipoRequisito) {
        this.idTipoRequisito = idTipoRequisito;
    }

    public Long getIdTipoRequisito() {
        return idTipoRequisito;
    }

    public void setIdTipoRequisito(Long idTipoRequisito) {
        this.idTipoRequisito = idTipoRequisito;
    }

    public String getValor() {
        return valor;
    }

    public void setValor(String valor) {
        this.valor = valor;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public List<Requisito> getRequisitoList() {
        return requisitoList;
    }

    public void setRequisitoList(List<Requisito> requisitoList) {
        this.requisitoList = requisitoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idTipoRequisito != null ? idTipoRequisito.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Tiporequisito)) {
            return false;
        }
        Tiporequisito other = (Tiporequisito) object;
        if ((this.idTipoRequisito == null && other.idTipoRequisito != null) || (this.idTipoRequisito != null && !this.idTipoRequisito.equals(other.idTipoRequisito))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.osiris.persistence.Tiporequisito[idTipoRequisito=" + idTipoRequisito + "]";
    }

}
